<?php
require '/IP.class.php';
$shengfen = array("北京","广东","山东","浙江","江苏","上海","辽宁","四川","河南","湖北","福建","湖南","河北","重庆","山西","江西","陕西","安徽","黑龙江","广西","吉林","云南","天津","内蒙","新疆","甘肃","贵州","海南","宁夏","青海","西藏");
$mysql_server_name='localhost'; //改成自己的mysql数据库服务器
 
$mysql_username='root'; //改成自己的mysql数据库用户名
 
$mysql_password='liwenbing'; //改成自己的mysql数据库密码
 
$mysql_database='taobaocaiji'; //改成自己的mysql数据库名

$conn=mysql_connect($mysql_server_name,$mysql_username,$mysql_password) or die("error connecting") ; //连接数据库
 
mysql_query("set names 'utf8'"); //数据库输出编码 应该与你的数据库编码保持一致.南昌网站建设公司百恒网络PHP工程师建议用UTF-8 国际标准编码.
 
mysql_select_db($mysql_database); //打开数据库
 

 
$sql="insert into cj_ordernum(ordernum,jiage,time,shouji,name,ip,shengfen) VALUES";

$temp = zhuanhuan($shengfen,1000);

//$myfile = fopen("num4.csv", "a") or die("Unable to open file!");
foreach($temp as $data){
    $sql .= $data . ",";
       // mysql_query($sql . $data); 
}
$sql = substr($sql,0,strlen($sql)-1);

mysql_query($sql);
echo '成功';

//fclose($myfile);

echo "<script>location.href='".$_SERVER["HTTP_REFERER"]."';</script>";





function zhuanhuan($shengfen,$num){
    for($i =0 ;$i< $num;$i++){
$sheng = $shengfen[rand(0,30)];
$sj = date('Y-').rand(1,5)."-" . rand(1,6) ." ". rand(1,23) .":". rand(1,59);
$ddh = date('Y').rand(0,99999). rand(0,99999);
$jr = rand(100,9999);
$shoujihao = shoujihao();
$ip_address[$i] ="(".$ddh. "," .$jr."," . "'" .$sj."'" . "," . "'" .$shoujihao ."'" .",". "'" .getXingList()."'" ."," . "'" .IP::generate($sheng)."'" ."," . "'" .$sheng."'" .")";
    }

    return $ip_address;

}



    /*

   获取姓列表

   */

    function getXingList()

    {

        $arrXing=array('赵','钱','孙','李','周','吴','郑','王','冯','陈','褚','卫','蒋','沈','韩','杨','朱','秦','尤','许','何','吕','施','张','孔','曹','严','华','金','魏','陶','姜','戚','谢','邹','喻','柏','水','窦','章','云','苏','潘','葛','奚','范','彭','郎','鲁','韦','昌','马','苗','凤','花','方','任','袁','柳','鲍','史','唐','费','薛','雷','贺','倪','汤','滕','殷','罗','毕','郝','安','常','傅','卞','齐','元','顾','孟','平','黄','穆','萧','尹','姚','邵','湛','汪','祁','毛','狄','米','伏','成','戴','谈','宋','茅','庞','熊','纪','舒','屈','项','祝','董','梁','杜','阮','蓝','闵','季','贾','路','娄','江','童','颜','郭','梅','盛','林','钟','徐','邱','骆','高','夏','蔡','田','樊','胡','凌','霍','虞','万','支','柯','管','卢','莫','柯','房','裘','缪','解','应','宗','丁','宣','邓','单','杭','洪','包','诸','左','石','崔','吉','龚','程','嵇','邢','裴','陆','荣','翁','荀','于','惠','甄','曲','封','储','仲','伊','宁','仇','甘','武','符','刘','景','詹','龙','叶','幸','司','黎','溥','印','怀','蒲','邰','从','索','赖','卓','屠','池','乔','胥','闻','莘','党','翟','谭','贡','劳','逄','姬','申','扶','堵','冉','宰','雍','桑','寿','通','燕','浦','尚','农','温','别','庄','晏','柴','瞿','阎','连','习','容','向','古','易','廖','庾','终','步','都','耿','满','弘','匡','国','文','寇','广','禄','阙','东','欧','利','师','巩','聂','关','荆','司马','上官','欧阳','夏侯','诸葛','闻人','东方','赫连','皇甫','尉迟','公羊','澹台','公冶','宗政','濮阳','淳于','单于','太叔','申屠','公孙','仲孙','轩辕','令狐','徐离','宇文','长孙','慕容','司徒','司空');

        $temp = count($arrXing); //姓总数
            $t = rand(0,1);
            if($t){
                $te =  $arrXing[rand(0,$temp-1)] . "先生";
            }else{
                $te =  $arrXing[rand(0,$temp-1)] . "女士";
            }
        return $te;

    }


function shoujihao(){
$arr = array(
    130,131,132,133,134,135,136,137,138,139,
    144,147,
    150,151,152,153,155,156,157,158,159,
    176,177,178,
    180,181,182,183,184,185,186,187,188,189,
);

    return $tmp = $arr[array_rand($arr)]. "****".mt_rand(1000,9999);

}



